#include "bestscore.h"
#include<qfile.h>
#include<QApplication>
#include<QString>

BestScore::BestScore()
{
    QFile file(QCoreApplication::applicationDirPath().append("/分数.txt"));
    file.open(QFile::ReadOnly);
    QByteArray est=file.readAll();
    file.close();
    score=est.toInt();
    //初始化

}

void BestScore::max()
{
    QFile file(QCoreApplication::applicationDirPath().append("/分数.txt"));
    file.open(QFile::WriteOnly|QFile::Text);
    file.write(QString::number(score).toUtf8());
    file.close();
    //存储最高分
}
void BestScore::in()
{
    QFile file(QCoreApplication::applicationDirPath().append("/分数.txt"));
    file.open(QFile::ReadOnly);
    QByteArray est=file.readAll();
    file.close();
    score=est.toInt();
    //最高分放入文档
}
